package com.kaiwukj.android.ufamily.mvp.ui.page.active;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.kaiwukj.android.ufamily.R;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.ActiveResult;
import com.kaiwukj.android.ufamily.utils.FormatUtils;

import java.util.ArrayList;

/**
 * Copyright © KaiWu Technology Company
 *
 * @author Haife
 * @job Android Development
 */
public class MyActiveListAdapter extends BaseQuickAdapter<ActiveResult, BaseViewHolder> {


    public MyActiveListAdapter() {
        super(R.layout.recycle_item_my_active, new ArrayList<>());
    }

    @Override
    public long getItemId(int position) {
        return getItem(position).getId();
    }

    @Override
    protected void convert(BaseViewHolder helper, ActiveResult item) {
        helper.setText(R.id.tv_my_active_title, item.getActivityTitle()).setText(R.id.tv_my_active_address,
                "地址：" + item.getActivityAddress())
                .setText(R.id.tv_my_active_end_time, "活动截止时间：" + FormatUtils.formatTime(item.getActivityEndTime()));
        TextView view = helper.getView(R.id.tv_my_active_status);
        //活动状态 1报名中 2未开始 3进行中 4已结束
        switch (item.getStatus()) {
            case 1:
                view.setText("报名中");
                break;
            case 2:
                view.setText("未开始");
                break;
            case 3:
                view.setText("进行中");
                break;
            case 4:
                view.setText("已结束");
                break;
        }
    }
}
